<template>
  <div class='base-info'>
    <header>基础资料</header>
    <main>
      <div v-for="(item, index) in modelData" :key="index" :class="{clearB:true,mb20:true}">
        <span class="title">{{item.label}}：</span>
        <UploadImg v-if="item.upload" :defaultImg0="item.default" />
        <span v-else-if="item.islabel">aaaaa</span>
        <el-button v-else-if="item.button" type="primary" class="btn" @click="item.button.click">{{item.button.label}}</el-button>
        <el-input v-else-if="item.isinput" v-model="userInfo[item.prop]" placeholder="" class="input"></el-input>
      </div>
      <el-button type="primary" class="submit-btn">提交</el-button>
    </main>

    <BankCard v-if="$store.state.dias.bankcard.show" />
  </div>
</template>
<script>
import UploadImg from '@/components/upload/uploadImg.vue'
import BankCard from './dia/bankcard.vue'
export default {
  components: {UploadImg,BankCard},
  name: "",
  data() {
    return {
      modelData:[
        {prop:"",label:"头像",upload:true,default:require('@/assets/imgs/center/default_user.jpg')},
        {prop:"",label:"联系电话",islabel:true},
        {prop:"",label:"银行卡卡号",button:{label:"绑定银行卡",click:this.showBank}},
        {prop:"phone",label:"联系电话",isinput:true},
        {prop:"",label:"身份证证号",isinput:true},
        {prop:"",label:"身份证正面",upload:true,default:require('@/assets/imgs/center/idcard.jpg')},
        {prop:"",label:"身份证反面",upload:true,default:require('@/assets/imgs/center/idcard.jpg')},
      ],
      userInfo:{},
    };
  },
  methods: {
    /**
     * 显示弹框
     */
    showBank(){
      this.$store.state.dias.bankcard.show=true
    }
  },
  created() {}
};
</script>
<style lang="scss" scoped>
.base-info {
  font-size: 14px;
  color: #666;

  header{
    line-height: 50px;
    text-indent: 20px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
  }
  main{
    padding: 35px 180px;

    >div{
      display: flex;

      >span.title{
        width: 100px;
        text-align: right;
        margin-right: 10px;
      }
      .btn{
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 0
      }
      .input{
        width: 200px;
        height: 30px;
      }
    }
    .submit-btn{
      width: 180px;
      border-radius: 0;
      padding: 0;
      line-height: 36px;
      margin-left: 100px;
      margin-top: 20px;
    }
  }
}
</style>